/*
 * ServerNetworkManager.java
 *    Author: nfk
 *      Date: Sep 19, 2008
 *      
 *   I'faces:
 *      ServerNetworkManager
 */

package at.syncme.framework.midp;

import java.io.IOException;

import at.syncme.framework.Event;

/**
 * An interface which extends NetworkManager with some server-specific methods.
 * 
 * @author nfk
 */
public interface ServerNetworkManager extends NetworkManager {

    /**
     * Opens a listening connection on the server.
     * 
     * @throws IOException
     *             if any network error occurs
     * @throws IllegalStateException
     *             if server is already listening
     */
    public void listen() throws IOException;

    /**
     * Returns if the server is listening.
     * 
     * @return if the server is listening
     */
    public boolean isListening();

    /**
     * Stops the listening service.
     */
    public void stop();

    /**
     * send an event to one client. mostly used for challenge-response
     * communication.
     * 
     * @param nodeId
     *            internal used nodeId
     * @param e
     * @throws IOException 
     */
    public void sendUnicast(short nodeId, final Event e) throws IOException;

}

/* End of ServerNetworkManager.java */
